using Autofac;
using CKS2320.Domain.DBEntity;
using CKS2320.Repository;
using CKS2320.Repository.Interface;
using CKS2320.Service;
using CKS2320.Service.Interface;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualBasic.ApplicationServices;
using System.ComponentModel;
using System.Configuration;
using System.Reflection;

namespace CKS2320.Controller
{
    internal static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var services = new ServiceCollection();
            ConfigureServices(services);
            using var serviceProvider = services.BuildServiceProvider();
            //TimerService timerService = new TimerService();
            //timerService.SetupDailyTask();
            using var form = serviceProvider.GetRequiredService<Controller>();
            Application.Run(form);
        }
        private static void ConfigureServices(IServiceCollection services)
        {
            //services.AddDbContext(ServiceLifetime.Transient); 
            //services.AddDbContext<DBContext>(options => options.UseSqlServer("Server=.;Database=CKS2320;Trusted_Connection=True;MultipleActiveResultSets=true;uid=sa;pwd=123456;"), ServiceLifetime.Transient);
            services.AddSingleton<Controller>();
            //services.AddTransient<DBContext, DBContext>();
            //services.AddScoped<IShapeService, ShapeService>();
            //services.AddScoped<IShapeRepository, ShapeRepository>();
            //services.AddScoped<IVoltageWithstandService, VoltageWithstandService>();
            //services.AddScoped<IVoltageWithstandRepository, VoltageWithstandRepository>();
            //services.AddScoped<IThicknessDetectionService, ThicknessDetectionService>();
            //services.AddScoped<IThicknessDetectionRepository, ThicknessDetectionRepository>();
        }
    }
}